<?php

namespace App\Dao;


use App\Model\UserLike;
use Hyperf\Context\ApplicationContext;

class UserLikeDao
{
    private static $instance;

    public static function getInstance()
    {
        if (!self::$instance) {
            self::$instance = Applicationcontext::getcontainer()->get(self::class);
        }
        return self::$instance;
    }

    public function checkUserLike($uid, $anchor_id)
    {
        // $res = $this->find("*","uid=? and anchor_id=? and status=?",[$uid,$anchor_id,2]);
        $res = UserLike::query()->where('uid', $uid)->where('anchor_id', $anchor_id)->where('status', 2)->first();
        if ($res) {
            return 1;
        }
        return 0;
    }


}